package cn.tedu.search.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;

@Data
@Accessors(chain = true) //可以通过一致.set.set.set 的实行进行对类的赋值
@AllArgsConstructor //生成全参构造方法
@NoArgsConstructor //生成无参构造方法
@Document(indexName = "students")
public class Student implements Serializable {

    @Id
    private Long id;

    @Field(type = FieldType.Keyword)
    private String name;

    @Field(type = FieldType.Keyword)
    private Integer age;

    @Field(type = FieldType.Text, analyzer = "ik_max_word",
            searchAnalyzer = "ik_max_word")
    private String address;
}
